package study.springcloud.discovery.eureka.support.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.eureka.server.event.EurekaRegistryAvailableEvent;
import org.springframework.cloud.netflix.eureka.server.event.EurekaServerStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 *
 */
@Slf4j
@Component
public class ServerListener {

    /**
     * 可用事件
     */
    @EventListener
    public void listen(EurekaRegistryAvailableEvent event) {
        log.info("EurekaInstanceRegisteredEvent {}", event.getSource());
    }

    /**
     * 服务端启动事件
     */
    @EventListener
    public void listen(EurekaServerStartedEvent event) {
        log.info("EurekaInstanceRegisteredEvent {}", event.getSource());
    }
}
